package org.NooLab.docserver.properties;

import org.NooLab.docserver.util.FileOrganizer;
import org.NooLab.utilities.files.DFutils;



public class DocumentObserverProperties 								
											extends 
														DocoAppPropertiesAbstract 
											implements 	// 
														DocoAppGeneralPropertiesIntf{


	public static final int _DOCO_DISPLAY_PROGRESS_BASIC = 1;
	public static final int _DOCO_DISPLAY_PROGRESS_STEPS = 2;
	
	public static final String _APP_CONTEXT_ITEXX = "itexx";
	public static final String _APP_CONTEXT_ALONE = "standalone";

	
	static DocumentObserverProperties dop;
	private DocoControlProperties docoControlProperties ;
	
	
	private boolean initializationOK;
	
	private boolean multithreadedProcesses;
	private boolean messagingActive;
	
	
	
	// ========================================================================
	public DocumentObserverProperties(){
		setDocoControlProperties(new DocoControlProperties(this));	
	}

	
	public static DocumentObserverProperties getInstance( String xmlSettingsStack ) {
		
		SettingsTransporter settingsTransporter;	
		 
		dop = new DocumentObserverProperties();
		
		if (xmlSettingsStack.length()>0){
			
			if (DFutils.fileExists(xmlSettingsStack)==false){
				
				String projectName = getpersistencesettings().getProjectName() ;
				
				String settingsDir = DFutils.createPath( systemRootDir, projectName+"/config/");
				//xmlSettingsStack = DFutils.createPath( settingsDir, "internal resources cfg.xml");

			}
			settingsTransporter = new SettingsTransporter( dop );
			dop = settingsTransporter.importProperties( xmlSettingsStack );
		}
		 
		return dop;

	}
	// ========================================================================

	
	private static PersistenceSettings getpersistencesettings() {
		return persistenceSettings ;
	}
	public PersistenceSettings getPersistenceSettings() {
		return getpersistencesettings() ;
	}

	public DocoControlProperties getControlProperties() {
		
		return getDocoControlProperties();
	}


	public void setInstanceType(int instanceTypeDefault) {

		fileOrganizer = new FileOrganizer();
		persistenceSettings = new PersistenceSettings(fileOrganizer);

		fileOrganizer.setPropertiesBase(this);

	}

	public void setGlueType(int vi) {
		// TODO Auto-generated method stub
		
	}

	
	private static String getsystemrootdir() {
		
		return systemRootDir;
	}
	
	public String getSystemRootDir() {
		// 
		String dir = getsystemrootdir();
		if (dir==null){
			dir="";
		}
		return dir;
	}

	public void setSystemRootDir(String dirname){
		systemRootDir = dirname;
	}
	
	
	public void setPathToDocoSystemRootDir(String approotFolder) {
		systemRootDir = approotFolder;
		
	}

	public int getWorkerType() {
		// 
		return workerType; 
	}

	

	public int getMultiProcessingLevel() {
		// 
		return 0;
	}

	public boolean getMultithreadedProcessing() {
		// 
		return multithreadedProcesses;
	}
	public void activateMultithreadedProcesses(boolean flag) {
		multithreadedProcesses = flag;
	}

	
	public void setDataStorageName(String datastorename) {
	
		dataStorageName = datastorename;
	}

	public void setGlueInstanceType(int i) {
		// TODO Auto-generated method stub
		
	}

	public void setMessagingActive(boolean flag) {
		messagingActive = flag;
	}

	public void setglueModuleMode(int i) {
		// TODO Auto-generated method stub
		
	}


	public void setShowDocoProgress(int docoDisplayProgressSteps) {
		
	}


	public boolean getInitializationOK() {
		return initializationOK;
	}
	public boolean isInitializationOK() {
		return initializationOK;
	}
	public void setInitializationOK(boolean initializationOK) {
		this.initializationOK = initializationOK;
	}
	

	public void setMultiProcessingLevel(int i) {
		// TODO Auto-generated method stub
		
	}

	public void save() {
		// TODO Auto-generated method stub
		
	}

	public int getGlueType() {
		return 0;
	}

	public int getMessagingActive() {
		return 0;
	}


	public boolean observeOnlyUsedDirectories() {
		return observeOnlyUsedDirectories;
	}


	public boolean isObserveOnlyUsedDirectories() {
		return observeOnlyUsedDirectories;
	}


	public void setObserveOnlyUsedDirectories(boolean observeOnlyUsedDirectories) {
		this.observeOnlyUsedDirectories = observeOnlyUsedDirectories;
	}


	public void setDocoControlProperties(DocoControlProperties docoControlProperties) {
		this.docoControlProperties = docoControlProperties;
	}


	public DocoControlProperties getDocoControlProperties() {
		return docoControlProperties;
	}



	
	
	
	
}
